import React, { Component } from "react";

// 通过父组件传递路由上下文

class Son extends Component {
  constructor(props) {
    super(props);
    console.log("非路由跳转过来的组件Son：this.props", this.props);
  }

  goLifecycle=()=>{
    this.props.history.push("/Lifecycle");
  }

  render() {
    return (
      <div>
        <h1>子组件</h1>
        <input type="button" value="去生命周期" onClick={this.goLifecycle} />
      </div>
    );
  }
}

export default Son;